<!DOCTYPE html>
<html>
	{include file="public/header" /}

	<body>
		<div class="layui-fluid">
			<div class="layui-card">
				<div class="layui-form layui-card-header layuiadmin-card-header-auto">
					<div class="layui-inline">
						<label class="layui-form-label">搜索条件</label>
						<div class="layui-input-block">
							<select name="sorch">
								<option value="1" selected="selected">全部</option>
								<option value="2">姓名</option>
								<option value="4">身份证号码</option>
								
							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">输入参数</label>
						<div class="layui-input-block">
							<input type="text" name="sorch_aaa" placeholder="请输入" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
					</div>
				</div>
			</div>
			<div class="layui-card-body">
				<table id="LAY-user-back-manage" lay-filter="LAY-user-back-manage"></table>
				<script type="text/html" id="table-useradmin-admin">
					<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon "></i>编辑</a>
					<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail"><i class="layui-icon "></i>详细</a>
				</script>
			</div>
		</div>
		</div>
		{include file="public/footer" /}
		<script>
			layui.use(['table'], function() {
				var $ = layui.$,
					form = layui.form,
					table = layui.table;

				//监听搜索
				form.on('submit(LAY-user-back-search)', function(data) {
					var field = data.field;

					//执行重载
					table.reload('LAY-user-back-manage', {
						where: field
					});
				});
				//监听工具条
				table.on('tool(LAY-user-back-manage)', function(obj) {
					var data = obj.data;
					// console.log(obj)
					if(obj.event === 'detail') {
						layer.open({
							type: 2,
							title: '身份认证详情',
							content: 'detail.html?ID=' + data.ID,
							area: ['70%', '70%'],
						});
					} else if(obj.event === 'edit') {
						layer.open({
							type: 2,
							title: '编辑管理员',
							content: 'editss.html?ID=' + data.ID,
							area: ['40%', '40%'],
							btn: ['确定', '取消'],
							yes: function(index, layero) {
								var iframeWindow = window['layui-layer-iframe' + index],
									submitID = 'LAY-user-back-submit',
									submit = layero.find('iframe').contents().find('#' + submitID);
								//监听提交
								iframeWindow.layui.form.on('submit(' + submitID + ')', function(data) {
									var field = data.field; //获取提交的字段
									//									console.log(12);
									//提交 Ajax 成功后，静态更新表格中的数据
									$.ajax({
										'type': 'post',
										'url': "{:url('admin/renzhengcards/edit')}",
										'data': field,
										dataType: 'json',
										success: function(res) {
											if(res.code == '0') {
												layer.msg(res.msg, {
													icon: 1
												});
											} else {
												layer.msg(res.msg, {
													icon: 5
												});
											}
											table.reload('LAY-user-back-manage');
											layer.close(index); //关闭弹层
										}
									});

								});

								submit.trigger('click');
							}
						});
					}

				});
				table.render({
					elem: '#LAY-user-back-manage',
					url: "{:url('admin/renzhengcards/get_list')}",
					toolbar: '#LAY-user-back-manage',
					title: '认证身份证',
						height: 'full-300',//最大高度
					cols: [
						[{
								type: 'checkbox',
								fixed: 'left'
							}, {
								type: 'numbers',
								title: '排序',
								width: 40,
								fixed: 'left',
								unresize: true,
							},
							{
								field: 'TrueName',
								title: '身份证姓名',
								width: 120,
								edit: 'text'
							},
							{
								field: 'TrueName2',
								title: '手机姓名',
								width: 120,
								edit: 'text'
							},
							{
								field: 'pipei',
								title: '姓名匹配',
								width: 120,
								edit: 'text'
							},

							{
								field: 'IDCard',
								title: '身份证号',
								width: 180,
								edit: 'text'
							},

							{
								field: 'Status',
								title: '状态',
								width: 180,
								edit: 'text',

							}, {
								field: 'RenzTime',
								title: '认证时间',

							},
							{
								fixed: 'right',
								title: '操作',
								toolbar: '#table-useradmin-admin',
								width: 130
							}
						]
					],
					page: true
				});
				$('.layui-btn.layuiadmin-btn-admin').on('click', function() {
					var type = $(this).data('type');
					active[type] ? active[type].call(this) : '';
				});
			});
		</script>
	</body>

</html>